refator(BREAKING)!: add support to create new requests Client#46
Merged
refator(BREAKING)!: add support to create new requests Client#46
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #46 +/- ##
==========================================
- Coverage 80.32% 80.19% -0.13%
==========================================
Files 6 7 +1
Lines 432 409 -23
==========================================
- Hits 347 328 -19
+ Misses 61 59 -2
+ Partials 24 22 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
wenchy
requested changes
Jul 22, 2025
Comment on lines
28
to
30
| func (r *Request) WithContext(ctx context.Context) *Request { | ||
| func (r *Request) WithContext(ctx context.Context) { | ||
| r.Request = r.Request.WithContext(ctx) | ||
| return r |
wenchy
requested changes
Jul 22, 2025
wenchy
requested changes
Jul 22, 2025
wenchy
requested changes
Jul 23, 2025
Comment on lines
15
to
28
| func newDefaultClient() *Client { | ||
| return &Client{ | ||
| client: &http.Client{ | ||
| CheckRedirect: redirector.RedirectPolicyFunc, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func GetDefaultClient() *Client { | ||
| once.Do(func() { | ||
| defaultClient = newDefaultClient() | ||
| }) | ||
| return defaultClient | ||
| } |
Owner
There was a problem hiding this comment.
- Default client should not be public.
- Timeout default to
10sfor common use cases.
client.go
Outdated
Comment on lines
44
to
45
| // WithInterceptor specifies an interceptor for requests made by this client. | ||
| // Use `ChainInterceptors` to chain multiple interceptors into one. |
Owner
There was a problem hiding this comment.
- Use doc links (see https://tip.golang.org/doc/comment#doclinks):``ChainInterceptors`` -> [ChainInterceptors]
- Confusing
for requests made by this client.->for client.
wenchy
approved these changes
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.